package com.mt.common.core.security;

import com.mt.common.core.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @ClassName: MyConfig
 * @Description:
 * @Author zhanghong
 * @Date 2022/5/13
 */
@Configuration
public class MyConfig implements WebMvcConfigurer {
    @Autowired
    Config config;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //WebMvcConfigurer.super.addResourceHandlers(registry);
        System.out.println(config.getUploadFileAddress());
        registry.addResourceHandler("/api/img/**").addResourceLocations("file:" + config.getUploadFileAddress());
        //registry.addResourceHandler("/api/img/**").addResourceLocations("file:" + config.getUploadFileAddress()+"\\");
    }
}
